# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /cvs/gentoo-ebuilds/gentoo-ebuilds/app-misc/tp-scroll/tp-scroll-1.0.ebuild,v 1.1 2003/05/08 17:18:29 srichey Exp $

inherit eutils

S=${WORKDIR}/${P}
DESCRIPTION="Thinkpad scroll daemon. Allows you to use the middle TP button to scroll."
HOMEPAGE="http://rsim.cs.uiuc.edu/~sachs/tp-scroll/"
SRC_URI="http://rsim.cs.uiuc.edu/~sachs/tp-scroll/${P}.tgz"

LICENSE="BSD-style"
SLOT="0"
KEYWORDS="x86"

IUSE=""

DEPEND="x11-base/xfree"


src_unpack() {
	unpack ${A}
	cd ${S}
	epatch ${FILESDIR}/Makefile.patch
}

src_compile() {
	emake || die "emake failed"
}

src_install() {
	
	emake DESTDIR="${D%/}" install
	
	insinto /etc/conf.d
	newins "${FILESDIR}/tp-scroll-conf" tp-scroll

	exeinto /etc/init.d
	newexe "${FILESDIR}/tp-scroll-init" tp-scroll

}

pkg_postinst() {
	if [ -f /mnt/.init.d/started/gpm ]; then
	ewarn "You appear to be running gpm. Please note"
	ewarn "that you can not run gpm and tpscroll at"
	ewarn "the same time. You will need to stop the"
	ewarn "gpm service before you can use tpscroll"
	fi
	echo
	einfo "**** PLEASE NOTE ****"
	einfo "In order to use tp-scroll, you must first"
	einfo "follow the instructions in the README located"
	einfo "in /usr/share/doc/${P}/ to setup "
	einfo "tp-scroll. It will not work otherwise!"
	echo
	einfo "To make sure this is always running, make"
	einfo "sure you run: rc-update add tp-scroll default"
	echo
}

